import type { CardData, CardDetail, CardListParams, CardParams } from "@/types/card";
import { myRequest } from "@/utils/reuqest";

// 获取月卡列表
export const getCardListApi = (params: CardListParams) => {
  return myRequest<CardData>('/parking/card/list', 'get', params)
}

// 添加月卡
export const addCardApi = (obj: Partial<CardParams>) => {
  return myRequest('/parking/card', 'POST', obj)
}

// 获取月卡详情
export const getCardApi = (id: string) => {
  return myRequest<CardDetail>(`/parking/card/detail/${id}`, 'GET')
}
// 更新月卡
export const updateCardApi = (obj: Partial<CardDetail>) => {
  return myRequest('/parking/card/edit', 'PUT', obj)
}

// 删除月卡
export const deleteCardApi = (ids: number[]) => {
  return myRequest(`/parking/card/${ids.join(',')}`, 'DELETE')
}